﻿/*******************************************************************************
 * AAEngine
 * Copyright (c) 2010 Mike Jarosch
 *
 * Original source PushButton Engine:
 * Copyright (C) 2009 PushButton Labs, LLC
 * For more information see http://www.pushbuttonengine.com
 *
 * This file is licensed under the terms of the MIT license, which is included
 * in the "MIT License.txt" file at the root directory of this SDK.
 ******************************************************************************/

using System.Collections.Generic;
using AAEngine.Engine.Resources;

namespace AAEngine.Sound
{
    public interface ISoundManager
    {
        /// <summary>
        /// Play a supplied sound, returning a ISoundHandle which allows management
        /// of the sound while it is playing.
        /// </summary>
#if WINDOWS_PHONE || XBOX
        ISoundHandle Play(SoundResource sound);
        ISoundHandle Play(SoundResource sound, string category);
        ISoundHandle Play(SoundResource sound, string category, float plan);
        ISoundHandle Play(SoundResource sound, string category, float plan, int loopCoun);
        ISoundHandle Play(SoundResource sound, string category, float plan, int loopCount, float startDelay);
#else
        ISoundHandle Play(SoundResource sound, string category = "sfx", float plan = 0, int loopCount = 0, float startDelay = 0);
#endif

        /// <summary>
        /// When true, all sound playback is muted.
        /// </summary>
        bool Muted { get; set; }

        /// <summary>
        /// The SoundManager volume controls global sound playback volume.
        /// </summary>
        float Volume { get; set; }

        /// <summary>
        /// For sanity purposes, all categories must be known to the manager. This
        /// prevents typos and other problems when specifying categories in the other
        /// calls. Before playing sounds or setting properties on a category, make
        /// sure to call createCategory first.
        /// </summary>
        /// <param name="category"></param>
        void CreateCategory(string category);

        /// <summary>
        /// If you wish to remove an existing category, removeCategory will do this for you. 
        /// </summary>
        /// <param name="category"></param>
        void RemoveCategory(string category);

        /// <summary>
        /// Mute a named category of sounds.
        /// </summary>
        /// <param name="category"></param>
        /// <param name="muted"></param>
        void SetCategoryMuted(string category, bool muted);

        /// <summary>
        /// Mute a named category of sounds.
        /// </summary>
        /// <param name="category"></param>
        /// <returns></returns>
        bool GetCategoryMuted(string category);

        /// <summary>
        /// Adjust the SoundTransform for a given category.
        /// </summary>
        /// <param name="category"></param>
        /// <param name="volume"></param>
        void SetCategoryVolume(string category, float volume);

        /// <summary>
        /// Adjust the SoundTransform for a given category.
        /// </summary>
        /// <param name="category"></param>
        /// <returns></returns>
        float GetCategoryVolume(string category);

        /// <summary>
        /// Stop all the sounds playing in a category.
        /// </summary>
        /// <param name="category"></param>
        void StopCategorySounds(string category);

        /// <summary>
        /// Stop all the sounds playing in the SoundManager.
        /// </summary>
        void StopAll();

        /// <summary>
        /// Fetch all the SoundHandles in the specified category and store them 
        /// in the provided array.
        /// </summary>
        /// <param name="category"></param>
        /// <param name="outArray"></param>
        void GetSoundHandlesInCategory(string category, ref IList<ISoundHandle> outArray);
    }
}
